<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1{
            display: flex;
            width: 500px;
            justify-content: space-between;
        }
        #box1 span {
            border: 1px solid red;
        }
    </style>
</head>

<body>
    <div id="box">
        <!-- <span id="bookname">1</span>
        <span id="author">2</span>
        <span id="publisher">3</span> -->
    </div>
    <script>
        const box = document.querySelector('#box')
        fetch('http://ajax-api.itheima.net/api/books')
            .then(res => res.json())
            .then(({ data }) => {
                box.innerHTML = data.map(e => {
                    return `
                    <div id="box1">
                        <span id="bookid">${e.id}</span>
                        <span id="bookname">${e.bookname}</span>
                        <span id="author">${e.author}</span>
                        <span id="publisher">${e.publisher}</span>
                    </div>
                    `
                }).join('')
            })
    </script>
</body>

</html>